'''
    调用Page页
    调用Page2页
'''
import logging
import time

from month.Page.Page import Page
from month.Page.Page2 import Page2
import pytest,yaml
from selenium import webdriver
from month.Tools.Tools import Tools
def data():
    with open(r'C:\Users\张震海\Desktop\month_8_12\month\baidu.yaml',encoding='utf-8') as f:
        return yaml.safe_load(f)

@pytest.fixture
def driver():
    driver = webdriver.Edge()
    driver.implicitly_wait(10)
    driver.maximize_window()
    Tools().log()
    yield driver
    driver.quit()

class Test_Base():
    @pytest.mark.parametrize('data',data())
    def test_baidu_login_001(self,driver,data):
        username = data.get('username')
        password = data.get('password')
        logging.info('begin')
        po = Page(driver)
        po.baidu_login_001(username,password)
        logging.info('last')
    def test_baidu_search_002(self,driver):
        logging.info('begin')
        po = Page2(driver)
        po.search_baidu_002()
        logging.info('last')

if __name__ == '__main__':
    pytest.main()